Passed
Branch main (ae8397)
by Ilya
01:02
created

utilities.js ➔ getCurrentPosition   A

Complexity

Conditions 1

Size

Total Lines 3
Code Lines 2

Duplication

Lines 3
Ratio 100 %

Importance

Changes 0
Metric Value
eloc 2
dl 3
loc 3
rs 10
c 0
b 0
f 0
cc 1
1
window.Utilities={random_int:function(t,n){return Math.floor(Math.random()*(n-t)+t)},urandom:function(t){let n="";for(let r=0;r<t;r++)n+=String.fromCharCode(Utilities.random_int(0,256));return n},fillArray:function(t,n){const r=[];for(let e=0;e<n;e++)r.push(t);return r},arrToInt:function(t){return parseInt(Array.prototype.map.call(t,t=>("00"+t.toString(16)).slice(-2)).join(""),16)},fileReader:function(t){let n=0,r=t;function e(r){let e=t.slice(n,n+r);return n+=r,e}return{readByte:function(){return e(1)[0]},readBytes:e,readBytesAsInt:function(t){return Utilities.arrToInt(e(t))},readBytesAsString:function(t){return Utilities.bytes_to_latin1(e(t))},getCurrentPosition:function(){return n},getLength:function(){return r.length}}},bytes_to_latin1:function(t){return CryptoJS.enc.Latin1.stringify(CryptoJS.enc.Uint8Arr.parse(t))},encode_to_words:function(t,n="Latin1"){return CryptoJS.enc[n].parse(t)}};